<template>
  <basic-container>
    <device-list ref="listRef" v-show="showType==='list'" @add="handleAdd"  @detail="handleDetail"></device-list>
    <device-q-a v-show="showType==='detail'" :the-row="theRow" @back="handleBack" ></device-q-a>
  </basic-container>
</template>

<script>

import DeviceList from "@/views/deviceManage/component/DeviceList";
import DeviceQA from "@/views/deviceManage/component/DeviceQA";
export default {
  name: "index",
  components: {DeviceQA, DeviceList },
  data() {
    return {
      showType: 'list',
      theRow: ''
    }
  },
  methods: {
    handleBack(flag){
      this.showType = 'list'
      if(flag) this.$refs.listRef.refresh()
    },
    handleAdd() {
      this.showType = 'add'
    },
    handleDetail(row) {
      this.showType = 'detail'
      this.theRow = row
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
